<!DOCTYPE html>
<html lang="en">
<head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <title>Anmol Cards - Product Details</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="author" content="WebsiteApps, Digvijay Mohite">


    <link href="<?php assetH("css/bootstrap.css") ?>" rel="stylesheet">
    <link href="<?php assetH("style.css") ?>" rel="stylesheet">
    <link href="<?php assetH("css/owl-carousel.css") ?>" rel="stylesheet">
    <link href="<?php assetH("css/flexslider.css") ?>" rel="stylesheet">
    <link href="<?php assetH("css/animate.min.css") ?>" rel="stylesheet">
    <link href="<?php assetH("css/prettyPhoto.css") ?>" rel="stylesheet">
    <link href='http://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700,700italic' rel='stylesheet'
          type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Lato:400,300,400italic,300italic,700,700italic,900'
          rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Exo:400,300,600,500,400italic,700italic,800,900' rel='stylesheet'
          type='text/css'>
    <link href="<?php assetH("royalslider/royalslider.css") ?>" rel="stylesheet">
    <link href="<?php assetH("royalslider/skins/default-inverted/rs-default-inverted.css") ?>" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="<?php assetH("rs-plugin/css/settings.css") ?>" media="screen"/>
    <link href="<?php asset("css/bttrlazyloading.min.css") ?>" rel="stylesheet" type="text/css"/>
    <link href="<?php assetH("css/spinner.css") ?>" rel="stylesheet">


    <!--[if lt IE 9]>
    <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!--[if lt IE 9]>
    <script src="<?php assetH(" js/respond.min.js")?>"></script>  <![endif]-->
    <script>
        var PRODUCT_ID = "<?php echo $product->getId(); ?>"
    </script>
</head>
<body>

<div class="animationload">
    <div class="loader">Loading...</div>
</div>
<div id="topbar" class="clearfix">
    <div class="container">
        <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
            <div class="social-icons">
                <span><a data-toggle="tooltip" data-placement="bottom" title="Facebook" href="#"><i
                            class="fa fa-facebook"></i></a></span>
                <span><a data-toggle="tooltip" data-placement="bottom" title="Google Plus" href="#"><i
                            class="fa fa-google-plus"></i></a></span>
                <span><a data-toggle="tooltip" data-placement="bottom" title="Twitter" href="#"><i
                            class="fa fa-twitter"></i></a></span>
                <span><a data-toggle="tooltip" data-placement="bottom" title="Youtube" href="#"><i
                            class="fa fa-youtube"></i></a></span>
                <span><a data-toggle="tooltip" data-placement="bottom" title="Linkedin" href="#"><i
                            class="fa fa-linkedin"></i></a></span>
                <span><a data-toggle="tooltip" data-placement="bottom" title="Dribbble" href="#"><i
                            class="fa fa-dribbble"></i></a></span>
                <span class="last"><a data-toggle="tooltip" data-placement="bottom" title="Skype" href="#"><i
                            class="fa fa-skype"></i></a></span>
            </div>
            <!-- end social icons -->
        </div>
        <!-- end columns -->
        <div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">
            <div class="topmenu">
                <span class="topbar-login"><i class="fa fa-user"></i> <a
                        href="<?php nav_url("client/login") ?>"><?php if ($user != null) {
                            echo $user;
                        } else {
                            echo "Login / Register";
                        } ?></a></span>
                <span class="topbar-cart"><i class="fa fa-shopping-cart"></i> <a
                        class="header-cart-popup"><?php echo $cart['noOfItems'] ?> item - <i class="fa fa-rupee"></i>
                        &nbsp;<?php echo $cart['totalRupees'] ?></a></span>
            </div>
            <!-- end top menu -->
        </div>
        <!-- end columns -->
    </div>
    <!-- end container -->
</div>
<!-- end topbar -->

<header id="header-style-1">
    <div class="container">
        <nav class="navbar yamm navbar-default">
            <div class="navbar-header">
                <button type="button" data-toggle="collapse" data-target="#navbar-collapse-1" class="navbar-toggle">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a href="index.html" class="navbar-brand"></a>
            </div>
            <!-- end navbar-header -->

            <div id="navbar-collapse-1" class="navbar-collapse collapse navbar-right">
                <ul class="nav navbar-nav">
                    <li><a href="<?php echo base_url() ?>">Home</a></li>
                    <li><a href="<?php nav_url("about"); ?>">About</a></li>
                    <li class="dropdown yamm-fw"><a href="#" data-toggle="dropdown" class="dropdown-toggle">Product
                            Gallery
                            <div class="arrow-up"></div>
                        </a>
                        <ul class="dropdown-menu">
                            <li>
                                <div class="yamm-content">
                                    <div class="row">
                                        <?php
                                        foreach ($categories as $category) {
                                            if ($category->getParent() == null && $category->getNoOfSub() > 0) {
                                                echo "<ul class='col-sm-3'>";
                                                echo "<li><h3>" . $category->getName() . "</h3></li>";
                                                foreach ($categories as $sub) {
                                                    if ($sub->getParent() != null && $sub->getParent()->getId() == $category->getId()) {
                                                        echo "<li><a href='" . nav_url_spl("gallery/item/" . $sub->getId()) . "'>" . $sub->getName() . "</a></li>";
                                                    }
                                                }
                                                echo "</ul>";
                                            }
                                        }
                                        ?>
                                    </div>
                                    <!-- end row -->
                                </div>
                            </li>
                        </ul>
                    </li>
                    <li><a href="<?php nav_url("contact"); ?>">Contact</a></li>
                </ul>
                <!-- end navbar-nav -->
            </div>
            <!-- #navbar-collapse-1 -->
        </nav>
        <!-- end navbar yamm navbar-default -->
    </div>
    <!-- end container -->
</header>
<!-- end header-style-1 -->

<section class="post-wrapper-top jt-shadow clearfix">
    <div class="container">
        <div class="col-lg-12">
            <h2>Product Details</h2>
            <ul class="breadcrumb pull-right">
                <li><a href="index.html">Product</a></li>
                <li><?php echo $product->getName() ?></li>
            </ul>
        </div>
    </div>
</section>
<!-- end post-wrapper-top -->

<section class="blog-wrapper">
<div class="container">
<div class="shop_wrapper col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="general_row">
    <div class="shop-left shop_item col-lg-6">
        <div class="entry">
            <?php
            $imgName = null;
            foreach ($product->getImages() as $img) {
                if ($img->getIsCover()) {
                    $imgName = $img->getName();
                    break;
                }
            }
            ?>
            <img alt="" class="img-responsive lazy-load-img" style="width:100%;"
                 data-bttrlazyloading-sm-src="<?php echo img_url() . $imgName ?>"
                 data-bttrlazyloading-sm-width="525"
                 data-bttrlazyloading-sm-height="400"
                 data-bttrlazyloading-md-width="525"
                 data-bttrlazyloading-md-height="400"
                 data-bttrlazyloading-lg-width="525"
                 data-bttrlazyloading-lg-height="400"/>

            <div class="magnifier">
                <div class="buttons">
                    <a href="<?php echo img_url() . $imgName ?>" class="sf" title=""
                       data-gal="prettyPhoto[product-gallery]"><span class="fa fa-search"></span></a>

                </div>
            </div>
            <!-- end magnifier -->
        </div>
        <!-- entry -->

        <div class="thumbnails clearfix">
            <?php
            foreach ($product->getImages() as $img) {
                ?>
                <div class="entry">
                    <img src="" alt="" class="img-responsive lazy-load-img" style="width:100%"
                         data-bttrlazyloading-sm-src="<?php echo img_url() . $img->getName() ?>"
                         data-bttrlazyloading-sm-width="160"
                         data-bttrlazyloading-sm-height="170"
                         data-bttrlazyloading-md-width="160"
                         data-bttrlazyloading-md-height="170"
                         data-bttrlazyloading-lg-width="160"
                         data-bttrlazyloading-lg-height="170"/>

                    <div class="magnifier">
                        <div class="buttons">
                            <a href="<?php echo img_url() . $img->getName() ?>" class="sf" title=""
                               data-gal="prettyPhoto[product-gallery]"><span
                                    class="fa fa-search"></span></a>
                        </div>
                        <!-- end buttons -->
                    </div>
                    <!-- end magnifier -->
                </div>

            <?php } ?>
        </div>
    </div>
    <!-- end shop-left -->

    <div class="shop-right col-lg-6">

        <div class="title">
            <h2><?php echo $product->getName() ?> <small> - <?php echo $product->getCategory()->getName()?></small></h2>

            <div class="rating">
                <i class="fa fa-star"></i>
                <i class="fa fa-star"></i>
                <i class="fa fa-star"></i>
                <i class="fa fa-star"></i>
                <i class="fa fa-star-o"></i>
            </div>
            <!-- rating -->
                            <span class="price" style="font-size: 25px !important;color:#D20000">
                                <i class="fa fa-inr"></i>
                                <?php echo $product->getPrice(); ?>

							</span>
            <small>per 100 pieces</small>
                            <span style="color:#D20000;font-weight:bold;">
                            <?php if($product->getDiscount() > 0){
                                echo $product->getDiscount() . " % Off";
                            }  ?>
                            </span>

                            <span class="compoare pull-right">
                            	<!--<a href="#">Compare</a>-->
							</span>
        </div>
        <div class="shop_desc">
            <?php echo $product->getDetails() ?>
        </div>

        <div class="shop_meta">
            <div class="pull-left">
                <div class="btn-shop">
                    <div class="form-inline">
                        <div class="form-group has-success has-feedback">
                            <input id="required-quantity" type="text" class="form-control"
                                   placeholder="Check avalibility" style="float:left;"/>
                            <button id="check-stock" class="btn woo_btn btn-primary"><i
                                    class="fa fa-check"></i></button>
                        </div>
                    </div>
                </div>
                <div id="stock-report">


                </div>
                <div id="stock-report-template" class="location-select-label" style="display:none">
                    <span class="stock-location-name">Available</span>
                </div>
            </div>
            <div class="pull-left" style="width:42%;">
                <div id="product-location-label" class="form-group">
                    <input type="hidden" name="product-location" id="product-location"/>
                </div>
                <div id="location-error-mgs" class="location-error-mgs">

                </div>
            </div>
            <div class="pull-right">
                <div class="btn-shop">
                    <a id="add-to-cart" class="btn woo_btn btn-primary" style="width:100px;">BUY
                        NOW</a><a><span><i class="fa fa-shopping-cart"></i></span></a>
                </div>
            </div>
            <!-- end pull-right -->
        </div>
        <!-- end shop meta -->

    </div>
    <!-- end shop-right -->
</div>
<!-- end row -->

<div class="clearfix"></div>
<div class="carousel_wrapper">
    <div class="title">
        <h2>Related Products</h2>
    </div>
    <!-- end title -->

    <div class="margin-top">
        <div id="owl_shop_carousel" class="owl-carousel">
            <?php
            foreach ($relateProducts as $prod) {
                $relateProdImg = null;
                foreach ($prod->getImages() as $img) {
                    if ($img->getIsCover()) {
                        $relateProdImg = $img->getName();
                        break;
                    }
                }
                ?>
                <div class="shop_carousel">
                    <div class="shop_item">
                        <div class="entry">
                            <img alt="" class="img-responsive lazy-load-img" style="width:100%;"
                                 data-bttrlazyloading-sm-src="<?php echo img_url() . $relateProdImg ?>"
                                 data-bttrlazyloading-sm-width="400"
                                 data-bttrlazyloading-sm-height="350"
                                 data-bttrlazyloading-md-width="400"
                                 data-bttrlazyloading-md-height="350"
                                 data-bttrlazyloading-lg-width="400"
                                 data-bttrlazyloading-lg-height="350"/>

                            <div class="magnifier">
                                <div class="buttons">
                                    <a class="st btn btn-default" rel="bookmark"
                                       href="<?php echo nav_url_spl("gallery/details/" . $prod->getId()) ?>">Add
                                        to Cart</a>
                                </div>
                                <!-- end buttons -->
                            </div>
                            <!-- end magnifier -->
                        </div>
                        <!-- end entry -->
                        <div class="shop_desc">
                            <div class="shop_title pull-left">
                                <a href="shop-single-sidebar.html"><span><?php echo $prod->getName() ?></span></a>
                                <span class="cats"><?php $prod->getCategory()->getName() ?></span>
                            </div>
                                    <span class="price pull-right">
                                        <i class="fa fa-inr"></i>
                                        <?php echo $prod->getPrice() ?>
                                    </span>
                        </div>
                        <!-- end shop_desc -->
                    </div>
                    <!-- end item -->
                </div><!-- end shop carousel -->
            <?php } ?>
        </div>
        <!-- end owl_blog_three_line -->
    </div>
    <!-- end padding-top -->
</div>
<!-- end carousel_wrapper -->
</div>
<!-- end shop-wrapper -->
</div>
<!-- end container -->
</section>
<!-- end postwrapper -->

<footer id="footer-style-1">
    <div class="container">
        <div class="col-lg-8 col-md-8 col-sm-6 col-xs-12">
            <div class="widget">
                <img class="padding-top" src="<?php assetH("images/logo.png") ?>" alt="">
                <p>Wedding is the most important & auspicious occasion of any ones life.It is not only occasion of two souls but weaving together of two families & their culture.
                    Anmol cards is the leading stockist of all types of wedding cards having three decades of experience is situated in the heart of  MIRAJ, SANGLI & KOLHAPUR  City.</p>
                <!-- end social icons -->
            </div>
            <!-- end widget -->
        </div>
        <!-- end columns -->

        <!-- end columns -->
        <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
            <div class="widget">
                <div class="title">
                    <h3>NewsLetter</h3>
                </div>
                <!-- end title -->
                <div class="newsletter_widget">
                    <p>Subscribe to our newsletter to receive news, updates, free stuff and new releases by email. We
                        don't do spam..</p>

                    <form action="#" class="newsletter_form">
                        <input type="text" id="subscribe-email" class="form-control" placeholder="Enter your email address">
                        <a href="#" class="btn btn-primary pull-right subscribe">Subscribe</a>
                    </form>
                    <!-- end newsletter form -->
                </div>
            </div>
            <!-- end widget -->
        </div>
        <!-- end columns -->
    </div>
    <!-- end container -->
</footer>
<!-- end #footer-style-1 -->

<!-- end #footer-style-1 -->

<div id="copyrights">
    <div class="container">
        <div class="col-lg-5 col-md-6 col-sm-12">
            <div class="copyright-text">
                <p>Copyright © <?php date_default_timezone_set("Asia/Calcutta");
                    echo date('Y'); ?> - Powered by <a href="http://www.websiteapps.in/">WebsiteApps</a> & <a
                        href="http://www.avisgraphics.co.in/"> Avis Graphics</a></p>
            </div>
            <!-- end copyright-text -->
        </div>
        <!-- end widget -->
        <div class="col-lg-7 col-md-6 col-sm-12 clearfix">
            <div class="footer-menu">
                <ul class="menu">
                    <li class="active"><a class="header-cart-popup" href="#">Terms & Conditions</a></li>
                    <li><a href="<?php nav_url("about"); ?>">About us</a></li>
                    <li><a href="<?php nav_url("contact"); ?>">Contact</a></li>
                </ul>
            </div>
        </div>
        <!-- end large-7 -->
    </div>
    <!-- end container -->
</div>
<!-- end copyrights -->

<div class="dmtop">Scroll to Top</div>
<div class="modal fade" id="stockModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:350px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">Stock Availability - <?php echo $product->getName() ?> -
                    <small><?php echo $product->getCategory()->getName() ?></small>
                </h4>
            </div>
            <div id="stock-table" class="modal-body" style="text-align: center">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<!-- Main Scripts-->
<script src="<?php assetH("js/jquery.js") ?>"></script>
<script src="<?php assetH("js/bootstrap.min.js") ?>"></script>
<script src="<?php assetH("js/menu.js") ?>"></script>
<script src="<?php asset("validator/jquery.form-validator.min.js") ?>"></script>
<script src="<?php assetH("js/owl.carousel.min.js") ?>"></script>
<script src="<?php assetH("js/jquery.parallax-1.1.3.js") ?>"></script>
<script src="<?php assetH("js/jquery.simple-text-rotator.js") ?>"></script>
<script src="<?php assetH("js/wow.min.js") ?>"></script>
<script src="<?php assetH("js/custom.js") ?>"></script>
<script src="<?php assetH("js/cart.js") ?>"></script>
<script src="<?php assetH("js/jquery.prettyPhoto.js") ?>"></script>
<script src="<?php asset("js/jquery.bttrlazyloading.min.js") ?>"></script>
<script src="<?php asset("js/jquery.form.js") ?>" type="text/javascript"></script>
<script src="<?php asset("dist/spin.min.js") ?>"></script>
<script src="<?php asset("dist/ladda.min.js") ?>"></script>
<script type="text/javascript">
    (function ($) {
        "use strict";
        jQuery('a[data-gal]').each(function () {
            jQuery(this).attr('rel', jQuery(this).data('gal'));
        });
        jQuery("a[data-gal^='prettyPhoto']").prettyPhoto({animationSpeed: 'slow', slideshow: false, overlay_gallery: false, theme: 'light_square', social_tools: false, deeplinking: false});
    })(jQuery);
</script>
<script>
    $(document).ready(function () {
        $(".lazy-load-img").bttrlazyloading();
    });
</script>
<script>
    var productId = "<?php echo $product->getId(); ?>";
    $(document).ready(function () {
        $("#check-stock").click(function (e) {
            var requiredQuantity = $("#required-quantity").val();
            if (requiredQuantity > 0) {
                $("#stock-report").html("");
                $.get("<?php nav_url("gallery/getProductStock/"); ?>" + productId, function (response) {
                    if (!response.error) {
                        var count = 0;
                        for (var i = 0; i < response.data.length; i++) {
                            var stock = response.data[i]
                            if (stock.actualStock >= requiredQuantity) {
                                count++;
                                var location = $("#stock-report-template").clone().css("display", "block");
                                $(location).attr("id", "location_" + stock.location.id);
                                $(location).find(".stock-location-name").text(stock.location.name);
                                $(location).hide().appendTo('#stock-report').slideDown('fast');
                            }
                        }
                        if (count == 0) {
                            var location = $("#stock-report-template").clone().css("display", "block").css("background-color", "red");
                            $(location).attr("id", "location_outOfStock");
                            $(location).find(".stock-location-name").text("Out of Stock.");
                            $(location).hide().appendTo('#stock-report').slideDown('fast');
                            $(location).addClass("out-of-stock");

                        }else{
                            $("#location-error-mgs").text("Click on Location to Select")
                        }
                    }
                });
            }else {
                $("#stock-report").html("<span style='color:red'>Please enter valid quantity.</span>");
            }
        });

        $("body").on("click","div.location-select-label",function(){
            if($(this).hasClass("out-of-stock")){
                return false;
            }
            $("div.location-select-label").each(function(){
                $(this).removeClass("location-select-label-selected");
            });
            $("#product-location").val(getElementId($(this).attr("id")));
            $(this).addClass("location-select-label-selected");

            var label = $(this).clone();
            $(label).addClass("location-select-report");
            $("#location-error-mgs").html(label);
            $("#stock-report").html("");

        });
    });

    var IMG_URL = "<?php img_url()?>";
    $("#add-to-cart").click(function (e) {
        var quantity = $("#required-quantity").val();
        var location = $("#product-location").val();
        if (location != -1) {
            if (quantity > 0) {
                $("#stock-report").html("");
                $("#myCart").modal("show");
                $("#cart-user-register").hide();
                $("#footer-action-btn").show();
                $(".cart-item-table-row").remove();
                $.get("<?php nav_url("shop/addToCart/")?>" + PRODUCT_ID + "/" + location + "/" + quantity, function (response) {
                    if (!response.error) {
                        $("#cart-loader").hide();
                        $("#cart-message").hide();
                        if (response.data.length > 0) {
                            var actualTotalAmount = 0;
                            var discountTotalAmount = 0;
                            var estimateTotalAmount = 0;
                            for (var i = 0; i < response.data.length; i++) {
                                var item = response.data[i];
                                var row = $("#cart-item-template").clone().show();
                                $(row).attr("id", "cart_" + item.cartId);
                                $(row).addClass("cart-item-table-row");
                                $(row).find(".cart-product-img").attr("src", IMG_URL + item.img);
                                $(row).find(".cart-product-name").text(item.name);
                                $(row).find(".cart-product-discount").text(item.discount + " %");
                                $(row).find(".cart-product-price").html("<i style='font-size:13px' class='fa fa-rupee'/> " + item.price);
                                $(row).find(".cart-product-qty").val(item.quantity);
                                $(row).find(".cart-product-subtotal").html("<i style='font-size:13px' class='fa fa-rupee'/> " + item.subtotal);
                                $(row).find(".remove").attr("id", item.cartId);
                                $("#cart-table").append(row);
                                actualTotalAmount += item.subtotal;
                                discountTotalAmount += item.subtotal - item.discountTotal;
                                estimateTotalAmount += item.discountTotal;
                            }
                            $("#header-cart-popup").html(response.data.length + " item - <i class='fa fa-rupee'/>" + parseFloat(estimateTotalAmount).toFixed(2));
                            $("#cart-total").text(parseFloat(actualTotalAmount).toFixed(2));
                            $("#cart-discount").text(parseFloat(discountTotalAmount).toFixed(2));
                            $("#cart-estimated-total").text(parseFloat(estimateTotalAmount).toFixed(2));
                            $("#cart-table-container").show();
                            $("#place-order").removeAttr("disabled");
                        } else {
                            $("#cart-message").show();
                            $("#cart-message").html("<h3>No Product was found in cart !</h3>");
                        }
                        $("#location-error-mgs").html("");
                        $("#required-quantity").val("");
                    }
                });
            } else {
                $("#stock-report").html("<span style='color:red'>Please enter valid quantity.</span>");
            }
        } else {
            $("#product-location-label").addClass("has-error");
            $("#location-error-mgs").text("Please select location");
        }

        e.preventDefault();
    });

    $("#product-location").change(function () {
        if ($(this).val() != -1) {
            $("#product-location-label").removeClass("has-error");
            $("#location-error-mgs").text("");
        }
    })

    function getElementId(element){
        var startIndex = element.indexOf("_");
        if(!isNaN(element.substr(startIndex + 1, element.length))){
            return parseInt(element.substr(startIndex + 1, element.length));
        }
        return undefined;
    }
</script>
<?php include('cartpopup.php') ?>
<?php include("cartjs.php") ?>
</body>
</html>